<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns=" http://www.w3.org/1999/xhtml">

<head>
	<base href="<%=basePath%>">
		<link href="themes/css/ui.common.css" rel="stylesheet"
			type="text/css" />
		<link href="themes/css/ui.child.css" rel="stylesheet"
			type="text/css" />
		<link href="themes/css/ui.tips.css" rel="stylesheet"
			type="text/css" />
		<link href="style/jquery_ui/jquery-ui-1.8.custom.css"
			rel="stylesheet" type="text/css" />
		<link id="skin_css" rel="stylesheet" type="text/css"
			href="themes/css/ui.c.blue.css"></link>
		<link rel="stylesheet"
			href="themes/default/pagination.css" type="text/css"></link>
		<link href="ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
		<link href="themes/css/ui.validation.css" rel="stylesheet" type="text/css" />			
		<script src="Scripts/jquery-1.4.1.min.js"
			type="text/javascript"></script>
		<script type="text/javascript"
			src="Scripts/jquery.json-2.2.min.js"></script>
		<script src="Scripts/jquery-ui-1.8.custom.min.js"
			type="text/javascript"></script>
		<script src="Scripts/ui.admincp.js"
			type="text/javascript" charset="UTF-8"></script>
		<script src="Scripts/ui.validation.js" 
			type="text/javascript"></script>
		<script src="ligerUI/Plugins/ligerDrag.js" type="text/javascript">
		</script>
    	<script src="ligerUI/Plugins/ligerResizable.js" type="text/javascript"></script>
 		<script src="ligerUI/Plugins/ligerLayout.js" type="text/javascript"></script>
    	<script type="text/javascript" src="ligerUI/Plugins/ligerDateEditor.js"></script>
    

<script type="text/javascript" src="ui.validation.js"></script>
		<STYLE type="text/css">
.editorArea {
	display: none;
}
</STYLE>
		<script type="text/javascript">
				$(function(){
				
			$("#dialog").dialog("destroy"); 
			$("#dialog-form").dialog({
			autoOpen: false,
			height: 450,
			width: 500,
			modal: true,
			buttons: {
				Cancel: function() {
					$(this).dialog('close');
				}
			},
			close: function() {
				//allFields.val('').removeClass('ui-state-error');
			}
			});
			 $("#form_startTime,#form_endTime").ligerDateEditor({ width: 200,   format: "yyyy-MM-dd" });
            $("#dialog-form").validatingForm({
                submitButtonId: "#btnSubmit", 
                showSingleError: false,
                showSingleError: false,
                validateOnBlur: true,
                clearErrorTipsTrigger:"#cancelAddGoodsInfoButton",
                summaryTo: "#errorSummary"
            }); 
			
					$('#addLeaveInfoButton').click(function() {   
					var now= new Date();  
   					var year=now.getYear();  
   					var month=now.getMonth()+1;  
   					var day=now.getDate();
   					var hour=now.getHours();
 					var minute=now.getMinutes();
 					if(month<10)
{
var month= "0"+month; 
}
if(day<10)
{
var day="0"+day;
}
 					if(minute<10)
 					{
 					var minute="0"+minute;
 					}
   					var defaultStartTime=year+"-"+month+"-"+day+" "+hour+":"+minute;
						
			$("#dialog-form").dialog({'title':"请假单"});
			$("#form_startTime").val(defaultStartTime);
			$("#form_endTime").val(defaultStartTime);
			
			
			$('#dialog-form').dialog('open'); 
			});

			$('#TestButton')
			.click(function() { 

			    var id = $(this).attr("entityId");
			    alert(id);
			
			    	$(".validateTips").html("<div>新闻"+id+"正在加载...</div>");
			    //ajax..
			    $.post("notice!queryDetail.action",{"query_id":id},function(data){
			    	
			    	$(".validateTips").html("");
			    	alert(data);
			    	var objectFromServer = $.toJSON(data);
			    	
			    	alert("d:"+objectFromServer.noticeInfo.content);
			    },"json");		    
			    //success:function(data){
			     $('#dialog-form').dialog('open');
			    //});
			
				
			});
			    
		    });
			</script>
			
			
			
<script type="text/javascript"
			src="Scripts/ui.dialogFormHelper.js"></script>
		<SCRIPT type="text/javascript">
		 
				$(function(){
					$("#link_page_prev,#link_page_next").click(function(){
			    		var currentPage = $(this).attr("currentPage");// noticelist!query.action?currpage=${currpage+1}&noticeTitle='' 
			    	 
			    		goToPage(currentPage);
			    	}); 
			    	
			    	$("#searchButton").click(function(){
			    		goToPage(1);
			    	});
			    	
			    	initSearch();
				});
				
				function initSearch()
				{
				    $("#txt_noticeTitle").val();
				}
			 
				function goToPage(currentPage)
				{
				    var staffName = $("#txt_staffName").val();
				    var title =$("#txt_title").val(); 
				    
				    //noticelist!query.action?currpage=${currpage-1 }
					location.href = "leave!manager.action?currpage="+currentPage+"&staffName="+staffName 
							+ "&title="+title;
				}  
				function checkAll(str)
				{
　 					var items = document.getElementsByName(str);　 //获取所有复选框
　					var totalNum = items.length;　 //获取复选框的个数
　 					for (var i=0; i<totalNum; i++)
　 					items[i].checked = window.event.srcElement.checked;//通过单击的按钮判断是选中还是未选
				}
				
				function deleteAll(str)
				{
					var isTo = checkDeleteAll("请假记录");
					if(isTo==false)
  					return ;
　 					var items = document.getElementsByName(str);　 //获取所有复选框
　					var totalNum = items.length;　 //获取复选框的个数
					var delStr = "";
　 					for (var i=0; i<totalNum; i++){
　 						if(items[i].checked == true){
							delStr += items[i].value + ","; 
						}
					}
					delStr = delStr.substring(0, delStr.length -1);
					
					location.href= "leave!deleteMore.action?leaveIds="+delStr+"&currpage="+${currpage};
				}
			</SCRIPT>

	</head>

	<body>
			 <div class="PageChild_Title">
        <img src=" themes/images/default/icons/archives.png" class="PageChild_Tbtnpic" />
        <span class="PageChild_separate"></span><span class="PageChild_TbtnText">
        <h2>
      	管理我的请假单
        </h2>
        </span><span class="PageChild_separate"></span>
        <div id="marker" class="red-tips">
        </div>
        <div class="clear">
        </div>
    </div>
		<div class="PageChild_Where">
			<table style="height: 60px;" border="0" cellpadding="0"
				cellspacing="0">
				<tr>
					<td class="mtd">
						&nbsp;请假人姓名:<s:textfield name="staffName" maxlength="70"
							id="txt_staffName"  theme="simple" readonly="true"/>
					</td>
					<td class="mtd">
						&nbsp;请假单标题:<s:textfield name="title"  maxlength="70"
							id="txt_title"  theme="simple" readonly="true"/>
					</td>
					<td>
						<input type="submit" name="searchButton" class="o-btn SubmitButton" value="搜索"
							id="searchButton" />
					</td>
				</tr>
				<tr>
					<td>
					&nbsp;<input type="button" id="addLeaveInfoButton" class="o-btn" value="添加请假单" />
					</td>
				</tr>
				<tr>
					<td colspan="5">
					&nbsp;<span id="lbl_list_count">共有 <b>${count}</b> 条未被审批的请假记录。</span>
						
					</td>
				</tr>
			</table>
		</div>
		<div class="PageChild_List" style="height:100%;">
			<table width="100%"   border="0" cellspacing="0"
				style="text-align: left">
				<tbody class="PageChild_List_head">
					<tr>
						<td width="16">
							<input id="Chk_All" type="checkbox" name="Chk_All"
								onclick="checkAll('Chk_Num')" />
						</td>
						<td>
							请假人
						</td>
						<td>
							请假单标题
						</td>
						<td>
							请假起始时间
						</td>
						<td>
							请假终止时间
						</td>
						<td>
							请假理由
						</td>
						<td class="td_width45">
							撤销请假
						</td>
					</tr>
				</tbody>
				<tbody class="PageChild_List_main" style="text-align: left">
					<!-- 请假列表开始 -->
					<s:if test="list!=null&&list.size!=0">
					<s:iterator value="list" var="item">
						<tr class='td_no_bord'>
							<td class="td_width25">
							<span title="${item.leaveId}"><input id="Chk_Num" type="checkbox"
										name="ReptShow$ctl01$Chk_Num" value="${item.leaveId}" /> </span>
							</td>
						    <td>
								<span> ${item.staffInfo.archiveInfo.staffName}&nbsp; </span>
							</td>
							<td>
								<span> ${item.title}&nbsp; </span>
							</td>
							<td>
								<s:date name="startTime" format="yyyy-MM-dd HH:mm"/>
							</td>
							<td>
								<s:date name="endTime" format="yyyy-MM-dd HH:mm"/>
							</td>
							<td>
								<span> ${item.reason}&nbsp;</span>
							</td>
							<td>
								<a href="javascript:;"
									onclick='location="leave!delete.action?delete_id=${item.leaveId}&currpage=${currpage}";'><img
										src="<%=basePath%>/themes/icons/delete.png" title="单击删除会议信息"/> 
								</a> &nbsp;
								</td>
						</tr>
					</s:iterator>
					</s:if><s:else>
						<tr>
							<td colspan="7">无记录</td>
						</tr>
					</s:else>
					<!-- 请假列表结束 -->

				</tbody>
			</table>
			<div id="divTopPageNavi" class="list_r_title_text3">

				<!--分页导航开始-->
				<s:if test="currpage<=1">
					<span class='list_r_title_text3a'> <img
							src="<%=request.getContextPath()%>/themes/images/default/page_up_gray.gif"></img>
					</span>

				</s:if>
				<s:else>
					<span class='list_r_title_text3a'> <a name="link_page_prev"
						id="link_page_prev" href="javascript:void(0);"
						currentPage="${currpage-1}"> <img
								src="<%=request.getContextPath()%>/themes/images/default/page_up.gif"></img>
					</a> </span>
				</s:else>
				<span class='list_r_title_text3b'> 第${currpage
					}页/共${totalpage }页 </span>
				<s:if test="currpage>=totalpage">
					<span class='list_r_title_text3a'> <img
							src="<%=request.getContextPath()%>/themes/images/default/page_down_gray.gif"></img>
					</span>
				</s:if>
				<s:else>
					<span class='list_r_title_text3a'> <a name="link_page_next"
						id="link_page_next" href="javascript:void(0);"
						currentPage="${currpage+1 }"> <img
								src="<%=request.getContextPath()%>/themes/images/default/page_down.gif"></img>
					</a> </span>
				</s:else>
				<span id="goToPageTextArea"><input type="text"
						class="easyui-numberbox" id="goPageNum" max="${totalpage}" min="1" />
					<input type="button" id="turnToPageButton" value="GO" />
				</span>
				<!--分页导航结束-->
			</div>
			<div>
			<input type="button" name="btn_Delete" class="o-btn SubmitButton"
				value="删 除" id="btn_Delete"
				onclick="deleteAll('ReptShow$ctl01$Chk_Num')">
			</div>
		</div>
		<!-- 弹出层标签 -->

<div id="dialog-form" style="display:none " title="请假单">
        <div class="ui-mainTab">
            <div>
                <form action="leave!add.action">
                <table width="100%" class="tb tb2">
                    <tbody>
                        <tr>
                            <td class="mtd">
                                <span id="span_form_title">请假单标题</span>:
                            </td>
                            <td>
                                <input class="control clearable required-field" value="" id="form_title" name="leaveInfo.title">
                            </td>
                        </tr>
                        <tr>
                            <td class="mtd">
                                <span id="span_form_reason">请假理由</span>:
                            </td>
                            <td>
                                <input class="control clearable required-field"  value="" id="form_reason" name="leaveInfo.reason">
                            </td>
                        </tr>
                        <tr>
                            <td class="mtd">
                                请假起始时间:
                            </td>
                            <td>
                                <input class="control clearable dateTime-field" than="now" fieldname="起始时间" id="form_startTime"
                                    style="width: 120px;" value="" name="leaveInfo.startTime">
                            </td>
                        </tr>
                        <tr>
                            <td class="mtd">
                                请假终止时间:
                            </td>
                            <td>
                                <input type="text" class="control clearable dateTime-field" fieldname="终止时间" id="form_endTime"
                                    than="#form_startTime" beyond="between;now;1,0,0"  style="width: 120px;" name="leaveInfo.endTime" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                &nbsp;
                            </td>
                            <td>
                                <div>
                                    <input id="btnSubmit" type="submit" value="提交">
                                    &nbsp;&nbsp;
                                    <input type="button" name="name" id="cancelAddGoodsInfoButton" class="dialogFormCloseButton"
                                        dialogform="#dialog-form" value="取消" />
                                </div>
                            </td>
                            <td>
                                &nbsp;
                            </td>
                        </tr>
                    </tbody>
                </table>
                </form>
                <div id="errorSummary">
                </div>
            </div>
        </div>
    </div>
			<!-- 弹出层结束 -->
	</body>


</html>
